package com.uidp.ui;

import com.acsior.sbc.exception.BusinessException;
import com.acsior.sbc.exception.SearchException;
import com.acsior.wu.bean.MBGeneralCriteriaSearch;
import com.acsior.wu.request.RequestManager;
import com.uidp.domain.Usergroups;
import com.uidp.search.UsergroupSearch;
import com.uidp.uitils.ManagedBeans;
import com.uidp.uitils.NavOutcomes;

public class MBSearchUsergroups extends MBGeneralCriteriaSearch<UsergroupSearch, Usergroups> {
	
	private String groupname;

	public MBSearchUsergroups() {
		super(UsergroupSearch.class);
	}

	@Override
	public void initData() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void specificSearch() throws SearchException, BusinessException {
		setTableRows(Usergroups.searchActiveByUserName(getGroupname()));
		
	}
	
	public String navToEdit(){
		Usergroups s = getTableRows().get(getSelectedRow());
		RequestManager.putInRequest(ManagedBeans.regUsergroup, s);
		return navigate(NavOutcomes.regGroup);
	}
	
	/**
	 * @see MBGeneral#getManagedProp()
	 */
	protected ManagedBeans getManagedProp() {
		return ManagedBeans.searchUsergroup;
	}


	public String getGroupname() {
		return groupname;
	}

	public void setGroupname(String groupname) {
		this.groupname = groupname;
	}
	

}
